﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="FriendshipRequest.aspx.vb" Inherits="Veterans.FriendshipRequest" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<table style="width: 100%; text-align: center;">
    <tr>
        <td> Other Request to you </td>
        <td> Your Requests to other users </td>
    </tr>
    <tr>
        <td>
            <center>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                DataSourceID="SqlDataSource1" CellPadding="4" ForeColor="#333333" 
                GridLines="None" DataKeyNames="F_ID">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField DataField="F_ID" visible="false" />
                    <asp:BoundField DataField="FromUserName" HeaderText="From UserName" SortExpression="FromUserName" ReadOnly="True" />
                    <asp:BoundField DataField="ToUserName" HeaderText="To UserName" SortExpression="ToUserName" ReadOnly="True" />
                    <asp:CheckBoxField DataField="RequestApproved" HeaderText="Approved ? " SortExpression="RequestApproved" />
                    <asp:CommandField ShowEditButton="True" />
                </Columns>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#EFF3FB" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"         
                SelectCommand="SELECT * FROM [TBL_Friend_Request] WHERE ([ToUserName] = ?)"
                UpdateCommand="UPDATE [TBL_Friend_Request] SET [RequestApproved] = @RequestApproved WHERE [F_ID] = @F_ID ">
                    <SelectParameters>
                        <asp:parameter name="ToUserName" type="String" />
                    </SelectParameters>
            </asp:SqlDataSource>
            </center>
        </td>
        <td>
            <center>
            <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                DataSourceID="SqlDataSource2" CellPadding="4" ForeColor="#333333" 
                GridLines="None">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField DataField="FromUserName" HeaderText=" From User Name" SortExpression="FromUserName" />
                    <asp:BoundField DataField="ToUserName" HeaderText="To User Name" SortExpression="ToUserName" />
                    <asp:CheckBoxField DataField="RequestApproved" HeaderText="Approved ?" SortExpression="RequestApproved" />
                </Columns>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#EFF3FB" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"         
                SelectCommand="SELECT [FromUserName], [ToUserName], [RequestApproved] FROM [TBL_Friend_Request]">
            </asp:SqlDataSource>
            </center>
        </td>
    </tr>
</table>

</asp:Content>
